<?php

namespace app\common\model;

use app\common\model\Base;

class OrderHistory extends Base {
 
    
    
    public function getOrderStatusTextAttr($value, $data) {
        if ($data['order_status'] < 20)
            return '<span style="color:red">' . config_value('order_status', $data['order_status']) . '</span>';
        else
            return config_value('order_status', $data['order_status']);
    }
    

    /**
     * @title 添加一条订单跟踪记录
     */
    public function insert_one($order_id, $order_status, $remark, $notify = 0) {



        $post['order_id'] = $order_id;
        $post['order_status'] = $order_status;
        $post['remark'] = strip_tags($remark);
        $post['notify'] = $notify;

        
        $this->data($post);

        $this->save();
        
        $insert_id = $this->getAttr('id');
        
        
        return $insert_id ? $insert_id : 0;
    }

}
